<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/jsp/declare.jsp" %>

<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath %>" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>床-列表</title>
	<%@ include file="/common/jsp/common.jsp" %>
	
	<script>
	function bedEdit(dom) {
		var bedId = dom.parentNode.parentNode.id;
		if (bedId)
			redirect("mvc/master/${communityId}/${roomId}/" + bedId + "/bedEdit.htm");
	}
	function bedAdd() {
		redirect("mvc/master/bedEdit.html?communityId=${communityId}&roomId=${roomId}");
	}
	</script>
</head>
<body id="bed" class="bg-grey">
	<div class="picBar">
		<img src="aizu/images/room/room.jpg" />
	</div>
	<div class="address">地址：${address }</div>
	<table border="0" cellspacing="0" borderColor="#DADADA">
		<thead>
			<tr>
				<th>床号</th>
				<%-- <th>价格</th> --%>
				<th>房客</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="bed" items="${beds}">
			<tr id="${bed.id }">
				<td>${bed.bed_num }</td>
				<%-- <td><fmt:formatNumber value="${!empty bed.bed_price ? bed.bed_price : 0 }" pattern="#,##0.#"/></td> --%>
				<td>${bed.grant_name }</td>
				<td>${bed.is_rent eq 1 ? '已租' : '在租' }</td>
				<c:if test="${bed.is_rent eq 1 }">
				<td><button class="cantEdit">编辑</button></td>
				</c:if>
				<c:if test="${bed.is_rent ne 1 }">
				<td><button class="edit" onclick="bedEdit(this)">编辑</button></td>
				</c:if>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="button-bar center">
		<div class="button-bar center fixed bottom">
			<input type="button" value="新增床位" class="submit" onclick="bedAdd()" />
		</div>
	</div>
</body>
</html>